package com.situ.basic;

import com.situ.collection.Student;
import org.junit.jupiter.api.Test;

public class Demo {


    @Test
    public void test1() {
        byte a = 127;
        byte b = 127;
        //b = a + b;// 报编译错误:cannot convert from int to byte
        b += a; // 等价于 b = (byte)(b + a);
        System.out.println(b);

        short s1 = 1;
        //s1 = s1 + 1;
        s1 += 1;
        System.out.println(s1);
    }

    @Test
    public void test2() {
        final int[] array = {1, 2};
        //array = new int[]{2, 5};
        array[0] = 4;
        System.out.println(array[0]);


    }

    public void show(final int[] array) {

    }

    @Test
    public void test11() {
        String str1 = new StringBuilder("58").append("tongcheng").toString();
        String str2 = "58tongcheng";
        System.out.println(str2 == str1.intern());//true
        System.out.println((str1 == str1.intern()));//false
    }

    @Test
    public void test12() {
        String str1 = new StringBuilder("58").append("tongcheng").toString();
        //String str2 = "58tongcheng";
        System.out.println((str1 == str1.intern()));//true
    }

    @Test
    public void test44() {
        String str2 = new StringBuilder("ja").append("va").toString();
        System.out.println(str2);//java
        System.out.println(str2.intern());//java
        System.out.println((str2 == str2.intern()));//false
    }
}
